/**
  ******************************************************************************
  * @file    common.c
  * @author  Cresent
  * @version V1.0
  * @date    2018.10.17
  * @brief   Common funtions. 
  ******************************************************************************
  */

/* Includes ------------------------------------------------------------------*/
#include "common.h"

/* External variables --------------------------------------------------------*/

/* Private variables ---------------------------------------------------------*/

/* Exported variables --------------------------------------------------------*/

/* Private functions ---------------------------------------------------------*/

/* Exported functions --------------------------------------------------------*/
inline unsigned int TickTimeDiff(unsigned int tick)
{
	int32_t tickDiff = HAL_GetTick() - tick;
	if (tickDiff >= 0)
	{
		return (unsigned int)tickDiff;
	}
	else
	{
		return tickDiff + (unsigned int)HAL_MAX_DELAY;
	}
}
